
package guoan.core.configuration;

import guoan.core.filter.LoginFilter;

import org.sitemesh.config.ConfigurableSiteMeshFilter;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName:FilterConfig <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * Date: 2015年2月5日 下午3:26:49 <br/>
 * 
 * @version
 * @since JDK 1.7
 * @see
 */
@Configuration
public class FilterConfiguration {

    @Bean(name = "loginFilter")
    public FilterRegistrationBean loginFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setFilter(new LoginFilter());
        bean.addUrlPatterns("/webCustomer/*", "/webCustomer");
        bean.setOrder(1);
        return bean;
    }

    @Bean(name = "sitemeshFilter")
    public FilterRegistrationBean sitemeshFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setFilter(new ConfigurableSiteMeshFilter());
        bean.addUrlPatterns("/webCustomer/*", "/webCustomer");
        return bean;
    }

}
